home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Tools / Win95 Secrets / SETUP.Z / HEAPW32.H < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-19  |  3.1 KB  |  111 lines

  1. //==================================
  2. // WALKHEAP - Matt Pietrek 1995
  3. // FILE: HEAPW32.H
  4. //==================================
  5.  
  6. typedef struct tagHEAP_ARENA_DEBUG
  7. {
  8.     DWORD    size;    // Size of block, including arena, OR'ed with A0000000
  9.                     // If bottom bit is set, block is free
  10.     union
  11.     {
  12.         DWORD    alloc_EIP;    // 0x04    // If in-use block
  13.         DWORD    prev;        // 0x04    // if free block
  14.     }a;
  15.  
  16.     WORD    threadID;    // 0x08    (Free blocks are 0xFEFE)
  17.     WORD    signature;    // 0x0A 0x4842 = "BH", 0x4846 = "FH"
  18.  
  19.     union
  20.     {
  21.         DWORD    checksum;    // 0x0C    // If in-use block
  22.         DWORD    next;        // 0x0C    // If free block
  23.     }b;
  24. } HEAP_ARENA_DEBUG, *PHEAP_ARENA_DEBUG;
  25.  
  26.  
  27. typedef struct tagHEAP_ARENA_RETAIL
  28. {
  29.     DWORD    size;    // Size of block, including arena, OR'ed with A0000000
  30.                     // If bottom bit is set, block is free
  31. } HEAP_ARENA_RETAIL, *PHEAP_ARENA_RETAIL;
  32.  
  33.  
  34. typedef struct tagFREE_HEAP_ARENA_DEBUG
  35. {
  36.     HEAP_ARENA_DEBUG arena;
  37.     DWORD    freeBlockChecksum;        // 0x10    - only present if a free block
  38. } FREE_HEAP_ARENA_DEBUG, *PFREE_HEAP_ARENA_DEBUG;
  39.  
  40.  
  41. typedef struct tagFREE_HEAP_ARENA_RETAIL
  42. {
  43.     HEAP_ARENA_RETAIL    arena;
  44.     DWORD                prev;
  45.     DWORD                next;
  46. } FREE_HEAP_ARENA_RETAIL, *PFREE_HEAP_ARENA_RETAIL;
  47.  
  48.  
  49. typedef struct tagFREE_LIST_HEADER_DEBUG
  50. {
  51.     DWORD                    dwMaxBlockSize;
  52.     FREE_HEAP_ARENA_DEBUG    freeArena;
  53. } FREE_LIST_HEADER_DEBUG, *PFREE_LIST_HEADER_DEBUG;
  54.  
  55. typedef struct tagFREE_LIST_HEADER_RETAIL
  56. {
  57.     DWORD                    dwMaxBlockSize;
  58.     FREE_HEAP_ARENA_RETAIL    freeArena;
  59. } FREE_LIST_HEADER_RETAIL, *PFREE_LIST_HEADER_RETAIL;
  60.  
  61. typedef struct tagHEAP_HEADER_DEBUG
  62. {
  63.     DWORD    dwSize;        // 0x00 total size of heap (defaults to 1MB + 4K)
  64.     DWORD    nextBlock;    // 0x04 next reserved block of memory in this heap
  65.  
  66.     FREE_LIST_HEADER_DEBUG    freeListArray[4];    // 0x8
  67.                             // 0x08 start of array of free list structures
  68.                             // 0x18 bytes long.  Array of these.  Sizes
  69.                             // are 0x20, 0x80, and 0x200, and < 0xFFFFFFFF
  70.  
  71.     HANDLE                nextHeap;            // 0x68     Next heap in process
  72.  
  73.     PCRITICAL_SECTION    pCriticalSection;    // 0x6C    - for heap synchronization
  74.  
  75.     CRITICAL_SECTION    criticalSection;    // 0x70
  76.  
  77.     DWORD    unknown1[14];
  78.  
  79.     DWORD    creating_EIP;    // 0xC0
  80.     DWORD    checksum;        // 0xC4 checksum
  81.     WORD    creating_thread_ordinal;    // 0xC8
  82.     WORD    unknown2;        // 0xCA
  83.         
  84.     BYTE    flags;            // 0xCC HEAP_xxx flags
  85.     BYTE    unknown3;        // 0xCD filler
  86.     WORD    signature;        // 0xCE
  87. } HEAP_HEADER_DEBUG, *PHEAP_HEADER_DEBUG;
  88.  
  89. typedef struct tagHEAP_HEADER_RETAIL
  90. {
  91.     DWORD    dwSize;        // 0x00 total size of heap (defaults to 1MB + 4K)
  92.     DWORD    nextBlock;    // 0x04 next reserved block of memory in this heap
  93.  
  94.     FREE_LIST_HEADER_RETAIL    freeListArray[4];    // 0x8
  95.                             // 0x08 start of array of free list structures
  96.                             // 0x18 bytes long.  Array of these.  Sizes
  97.                             // are 0x20, 0x80, and 0x200, and < 0xFFFFFFFF
  98.  
  99.     HANDLE                nextHeap;            // 0x48     Next heap in process
  100.  
  101.     PCRITICAL_SECTION    pCriticalSection;    // 0x4C    - for heap synchronization
  102.  
  103.     CRITICAL_SECTION    criticalSection;    // 0x50
  104.  
  105.     DWORD    unknown1[2];                    // 0x68
  106.  
  107.     BYTE    flags;            // 0x70 HEAP_xxx flags
  108.     BYTE    unknown2;        // 0x71 filler
  109.     WORD    signature;        // 0x72
  110. } HEAP_HEADER_RETAIL, *PHEAP_HEADER_RETAIL;
  111.